const Router = require('koa-router')
const { reqLog } = require('../../../middleware/log')
const {
  get,
  list,
  del,
  create,
  update,
  run,
  runAll,
} = require('../../../controller/v1/admin/ref_system')
const { validateToken } = require('../../../middleware/auth/token')

const {
  getValidator,
  delValidator,
  listValidator,
  createValidator,
  updateValidator,
} = require('../../../middleware/validator/v1/ref_system')

const PREFIX = '/v1/admin/ref_system'

const router = new Router({ prefix: PREFIX })

router.get('/get', validateToken, getValidator, get)
router.put('/update', validateToken, updateValidator, reqLog, update)
router.post('/create', validateToken, createValidator, reqLog, create) // createValidator, reqLog,
router.get('/list', validateToken, listValidator, list)
router.delete('/del', validateToken, delValidator, reqLog, del)
router.post('/run', validateToken, getValidator, reqLog, run)
router.post('/runAll', validateToken, reqLog, runAll)

module.exports = router
